<?php
$isReloadable = true;
require_once("../../../pers/inc.config.php");
require_once('../../_inc/inc.session.php');
require_once('../../_inc/funct.html.php');


$sql_sel = "SELECT DISTINCT p.cod_dato, m.cod_mod_rbil, m.descr AS m_descr, d.descr AS d_descr " 
		." FROM rgl_mod_rbil m " 
		." LEFT JOIN rgl_mod_rbil_par_ind p ON p.id_mod_rbil = m.id_mod_rbil "
		." LEFT JOIN rgl_def_dato d ON d.cod_dato = p.cod_dato "
		."    AND d.id_set_dati = m.id_set_dati "
		." WHERE m.id_mod_rbil = ".reqVarInt('id')
		." ORDER BY p.cod_dato "
		;
$objDB->query($sql_sel,'selRec');
if (!$acX = $objDB->fetch('selRec')) {
	die ('parIndSettList - no id. '.reqVar('id'));
}
$cmdL = '';
$cmdL .= "<a class=\"cmd1\" href=\"parIndExport.php?id=".reqVar('id')
	."&xsn=".XSN."\" target='_blank'>export</a>";
$cmdL .= "&nbsp;&nbsp;&nbsp;";
$cmdL .= "<a class=\"cmd1\" href=\"parIndImport.php?id=".reqVar('id')
	."&xsn=".XSN."\">Import</a>";
$cmdL .= "&nbsp;&nbsp;&nbsp;";
$cmdL = "<a class=\"cmd1\" href=\"parIndSettList.php?id=".reqVar('id')
	."&xsn=".XSN."\">lista per settore</a>";
	
$cmdR = "&nbsp;&nbsp;&nbsp;";
if (true) {
	$cmdR .= "<a class=\"cmd1\" href=\"parIndDatMod.php?id=".reqVarInt('id')."&$sXSNQS\">aggiungi soglie indice</a>";
}
$cmdR .= cmdTorna(); 

testaHtml('Gestione modelli', $msgPag, 'modl');
echo getHtmlForm();
echo getHtmlHidden('xsn',XSN);
?>
<table class="cmd1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="left">
         <?=$cmdL?>
      </td>
      <td class="cmd1" align="right">
         <?=$cmdR?>
      </td>
   </tr>
</table>
<table class="tab1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="tit1" colspan='2' align='center'>Soglie settoriali - Lista indici di bilancio</td>
   </tr>
   <tr>
      <td class="lab1" align="left" width='10%'>Modello</td>
      <td class="txt1" align="left" width='90%'>
         <?=$acX['cod_mod_rbil']." - ".$acX['m_descr']?>
      </td>
   </tr>
   <tr>
      <td class="lab1" width='10%' align='center'>Indice</td>
      <td class="lab1" width='90%' align='center'>Descrizione</td>
   </tr>
         <? 
$clRF = 'txt2';
if (!empty($acX['cod_dato'])) while($acX) {
	$clRF = ($clRF=='txt1')?'txt2':'txt1';	
?>
   <tr>
      <td class="<?=$clRF?>">
      	<a href='parIndDatVis.php?<?="id=".reqVar('id')."&cd=".$acX['cod_dato']."&$sXSNQS"?>' class="<?=$clRF?>"
      	 	style='font-family:lucida console,courier;'>
            <?
            echo $acX['cod_dato'];
            ?>
         </a>
      </td>
      <td class="<?=$clRF?>" align='left'>
      <? echo $acX['d_descr']; ?>
      </td>
   </tr>
<? 
   $acX = $objDB->fetch('selRec');
}
?>
</table>
<table class="cmd1" border="0" cellpadding="3" cellspacing="1" width="100%" align='center'>
   <tr>
      <td class="cmd1" align="left">
         <?=$cmdL?>
      </td>
      <td class="cmd1" align="right">
         <?=$cmdR?>
      </td>
   </tr>
</table>
<?
echo "</form>\n";
codaHtml();
exit();
